<html>
<head><meta charset="utf-8"><title>rust-analyzer in nix · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html">rust-analyzer in nix</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="196216710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196216710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196216710">(May 04 2020 at 17:57)</a>:</h4>
<p>Hi, I made a little "hack" nix derivation that essentially downloads a github release of rust-analyzer. In the nix env I already have rust-src and I am then using coc.nvim with a super simple config but I do not get any completions on std? Any ideas what I can try?</p>



<a name="196217716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196217716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196217716">(May 04 2020 at 18:04)</a>:</h4>
<p>Currently using it without an extension like</p>
<div class="codehilite"><pre><span></span><code> &quot;rust-analyzer&quot;: {
            &quot;command&quot;: &quot;rust-analyzer&quot;,
            &quot;filetypes&quot;: [&quot;rust&quot;],
            &quot;rootPatterns&quot;: [&quot;Cargo.toml&quot;]
        },
</code></pre></div>



<a name="196218333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196218333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Timo Freiberg <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196218333">(May 04 2020 at 18:09)</a>:</h4>
<p>i don't know why that setup doesn't work, but i can recommend <a href="https://github.com/fannheyward/coc-rust-analyzer" title="https://github.com/fannheyward/coc-rust-analyzer"><code>coc-rust-analyzer</code></a></p>



<a name="196218551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196218551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196218551">(May 04 2020 at 18:11)</a>:</h4>
<p>Yeah, I have seen that one and will most likely try it but I would like to get a simpler case working first :)</p>



<a name="196218614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196218614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196218614">(May 04 2020 at 18:11)</a>:</h4>
<p>Another error I get is this one</p>
<div class="codehilite"><pre><span></span><code>[Error  - 7:39:31 PM] Request textDocument/documentHighlight failed.
  Message: content modified
  Code: -32801
</code></pre></div>



<a name="196218790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196218790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196218790">(May 04 2020 at 18:13)</a>:</h4>
<p>Is there some method to debug where it tries to find source?</p>



<a name="196219286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196219286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196219286">(May 04 2020 at 18:16)</a>:</h4>
<p>That error isn't really an error. It is just that you edited the document while it was processing a request.</p>



<a name="196219518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196219518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196219518">(May 04 2020 at 18:18)</a>:</h4>
<p>Ah, makes sense. But what about not getting completions on std? This is what I get from tracing:</p>
<div class="codehilite"><pre><span></span><code>[Trace - 8:16:54 PM] Sending request &#39;textDocument/completion - (6)&#39;.
Params: {
    &quot;textDocument&quot;: {
        &quot;uri&quot;: &quot;file:///Users/abbe/code/firm/services/avery/src/main.rs&quot;
    },
    &quot;position&quot;: {
        &quot;line&quot;: 5,
        &quot;character&quot;: 9
    },
    &quot;context&quot;: {
        &quot;triggerKind&quot;: 1
    }
}


[Trace - 8:16:54 PM] Received response &#39;textDocument/completion - (6)&#39; in 2ms.
Result: [
    {
        &quot;additionalTextEdits&quot;: [],
        &quot;deprecated&quot;: false,
        &quot;filterText&quot;: &quot;self&quot;,
        &quot;insertTextFormat&quot;: 1,
        &quot;kind&quot;: 14,
        &quot;label&quot;: &quot;self&quot;,
        &quot;textEdit&quot;: {
            &quot;newText&quot;: &quot;self&quot;,
            &quot;range&quot;: {
                &quot;end&quot;: {
                    &quot;character&quot;: 9,
                    &quot;line&quot;: 5
                },
                &quot;start&quot;: {
                    &quot;character&quot;: 9,
                    &quot;line&quot;: 5
                }
            }
        }
    },
    {
        &quot;additionalTextEdits&quot;: [],
        &quot;deprecated&quot;: false,
        &quot;filterText&quot;: &quot;super&quot;,
        &quot;insertTextFormat&quot;: 1,
        &quot;kind&quot;: 14,
        &quot;label&quot;: &quot;super&quot;,
        &quot;textEdit&quot;: {
            &quot;newText&quot;: &quot;super::&quot;,
            &quot;range&quot;: {
                &quot;end&quot;: {
                    &quot;character&quot;: 9,
                    &quot;line&quot;: 5
                },
                &quot;start&quot;: {
                    &quot;character&quot;: 9,
                    &quot;line&quot;: 5
                }
            }
        }
    }
]
</code></pre></div>


<p>This is after typing <code>std::</code></p>



<a name="196219785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196219785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196219785">(May 04 2020 at 18:20)</a>:</h4>
<p>I think rust-analyzer requires <code>rust-src</code> to be in the sysroot of rustc at <code>lib/rustlib/src/rust/src</code>.</p>



<a name="196219886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196219886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196219886">(May 04 2020 at 18:21)</a>:</h4>
<p>What is the result of <code>ls $(rustc --print sysroot)/lib/rustlib/src/rust/src/</code>?</p>



<a name="196220026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196220026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196220026">(May 04 2020 at 18:22)</a>:</h4>
<div class="codehilite"><pre><span></span><code>ls $(rustc --print sysroot)/lib/rustlib/src/rust/src/
build_helper  libcore         libpanic_unwind  libprofiler_builtins  libterm  libunwind  tools
liballoc      libpanic_abort  libproc_macro    libstd                libtest  stdarch
</code></pre></div>



<a name="196220168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196220168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196220168">(May 04 2020 at 18:23)</a>:</h4>
<p>That is what it should be. <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="196220467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196220467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196220467">(May 04 2020 at 18:25)</a>:</h4>
<p>Yeah, that is what I thought as well, and rls completions work :)</p>



<a name="196220549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196220549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196220549">(May 04 2020 at 18:26)</a>:</h4>
<p>And I do get completion on other external crates</p>



<a name="196220751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196220751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196220751">(May 04 2020 at 18:27)</a>:</h4>
<p>Is there any settings I could try (Is there a list of LSP settings somewhere?)?</p>



<a name="196221461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196221461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196221461">(May 04 2020 at 18:33)</a>:</h4>
<p>"RUST_SRC_PATH" overrided in editor ?</p>



<a name="196221618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196221618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196221618">(May 04 2020 at 18:34)</a>:</h4>
<p>Nope, the above command gives the same output inside of Vim</p>



<a name="196222058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196222058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196222058">(May 04 2020 at 18:38)</a>:</h4>
<p>There is a config setting in RA:</p>
<div class="codehilite"><pre><span></span><code>&quot;rust-analyzer.withSysroot&quot;: true
</code></pre></div>


<p>but it is true by default.</p>



<a name="196237467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196237467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196237467">(May 04 2020 at 20:43)</a>:</h4>
<p>Yeah, setting that did not really change anything :)</p>



<a name="196280809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196280809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196280809">(May 05 2020 at 08:39)</a>:</h4>
<p>rust-analyzeri is also in nixpgs already: <a href="https://github.com/NixOS/nixpkgs/blob/82dfd10035256585c52053172d67fbffbaa11fc9/pkgs/development/tools/rust/rust-analyzer/default.nix" title="https://github.com/NixOS/nixpkgs/blob/82dfd10035256585c52053172d67fbffbaa11fc9/pkgs/development/tools/rust/rust-analyzer/default.nix">https://github.com/NixOS/nixpkgs/blob/82dfd10035256585c52053172d67fbffbaa11fc9/pkgs/development/tools/rust/rust-analyzer/default.nix</a></p>
<p>That specific version might be old, but it should be possible to <code>overrideDerivation</code> / <code>overrideAttrs</code> to get the more recent one</p>



<a name="196620946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196620946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196620946">(May 06 2020 at 11:35)</a>:</h4>
<p>Yeah and that is super cool but for this project we are using a pinned downed version of 20.03 for nixpkgs where it is not yet present :)</p>



<a name="196620969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/196620969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#196620969">(May 06 2020 at 11:35)</a>:</h4>
<p>But guess I could try it and see if it makes a difference</p>



<a name="197336516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197336516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197336516">(May 12 2020 at 20:44)</a>:</h4>
<p>Hmm... it _does_ work when using the one in nixpkgs</p>



<a name="197338607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197338607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197338607">(May 12 2020 at 20:59)</a>:</h4>
<p>I know what is going on now... The version in nixpkgs is built with a wrapper script hardcoding <code>RUST_SRC_PATH</code> whereas the derivation I created relied on <code>rustc --print sysroot</code>. Seems like maybe rust-analyzer cannot find <code>rustc</code> (it is added to path by nix-shell) to run the <code>rustc --print sysroot</code> command (as seen above, it works when run in shell)</p>



<a name="197338759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197338759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197338759">(May 12 2020 at 21:00)</a>:</h4>
<p>As a temp workaround I guess I can set <code>RUST_SRC_PATH</code> (or maybe <code>RUSTC</code> <a href="https://github.com/rust-analyzer/rust-analyzer/blob/51e4b92c1e/crates/ra_toolchain/src/lib.rs#L32">https://github.com/rust-analyzer/rust-analyzer/blob/51e4b92c1e/crates/ra_toolchain/src/lib.rs#L32</a> ?) in the derivation</p>



<a name="197440732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197440732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197440732">(May 13 2020 at 16:43)</a>:</h4>
<p>Ok, I did some more digging into this... Both rust-analyzers (my derivation and the one from nixpgs) fail to give std completions if I use a <code>$RUST_SRC_PATH</code> that looks like this (this is from rustup):</p>
<div class="codehilite"><pre><span></span><code>$ ls /nix/store/bz2siw7ip2hin4yjgy7biw2fm38b4vwd-rust-1.43.1-2020-05-04-8d69840ab/lib/rustlib/src/rust/src
build_helper  liballoc  libcore  libpanic_abort  libpanic_unwind  libproc_macro  libprofiler_builtins  libstd  libterm  libtest  libunwind  stdarch  tools
</code></pre></div>


<p>However, both rust-analyzers work as expected if I instead give them a <code>$RUST_SRC_PATH</code> that looks like this (this one is from the rust-analyzer derivation in nixpkgs):</p>
<div class="codehilite"><pre><span></span><code>$ ls /nix/store/a2071dn4mhsyhp6ql70rj8wbgvrdq9vc-rust-src
README.md     libcore          libproc_macro          librustc_ast_passes      librustc_data_structures  librustc_feature      librustc_interface  librustc_metadata   librustc_plugin_impl    librustc_span    librustdoc    libtest
bootstrap     libfmt_macros    libprofiler_builtins   librustc_builtin_macros  librustc_driver           librustc_fs_util      librustc_lexer      librustc_mir        librustc_privacy        librustc_target  libserialize  libunwind
build_helper  libgraphviz      librustc               librustc_codegen_llvm    librustc_error_codes      librustc_hir          librustc_lint       librustc_mir_build  librustc_resolve        librustc_traits  libstd        rustc
liballoc      libpanic_abort   librustc_apfloat       librustc_codegen_ssa     librustc_errors           librustc_incremental  librustc_llvm       librustc_parse      librustc_save_analysis  librustc_ty      libsyntax     stage0.txt
libarena      libpanic_unwind  librustc_ast_lowering  librustc_codegen_utils   librustc_expand           librustc_index        librustc_macros     librustc_passes     librustc_session        librustc_typeck  libterm
</code></pre></div>


<p>Any ideas <span class="user-mention" data-user-id="133169">@matklad</span> ?</p>



<a name="197444027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197444027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197444027">(May 13 2020 at 17:04)</a>:</h4>
<p>We use RUST_SRC_PATH as a substitue for <code>--pirnt sysroot</code>: <a href="https://github.com/rust-analyzer/rust-analyzer/blob/c07050e2753a78e6975a6b78645970c18d7365b3/crates/ra_project_model/src/sysroot.rs#L89-L116">https://github.com/rust-analyzer/rust-analyzer/blob/c07050e2753a78e6975a6b78645970c18d7365b3/crates/ra_project_model/src/sysroot.rs#L89-L116</a></p>



<a name="197459807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197459807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197459807">(May 13 2020 at 18:57)</a>:</h4>
<p>Yeah I have seen that but the only difference between the working case and the mon-working one is the content of what is pointed to by RUST_SRC_PATH as stated above</p>



<a name="197460292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197460292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197460292">(May 13 2020 at 19:00)</a>:</h4>
<p>I.e. it works if I point it at the src folder of a git clone of Rust but it does not if I point it at a rustup installed rust-src</p>



<a name="197469081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197469081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197469081">(May 13 2020 at 20:07)</a>:</h4>
<p>Plot thickens, I now have one rust-src installed with rustup and one rust-src installed with the mozilla nix overlay. It works with the rustup-installed one but not with the nix overlay installed one and diffing the source folders, they are identical!</p>



<a name="197469113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197469113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197469113">(May 13 2020 at 20:07)</a>:</h4>
<p>(except for some shell shebangs)</p>



<a name="197469446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197469446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197469446">(May 13 2020 at 20:10)</a>:</h4>
<p>is there something else that is used in sysroot?</p>



<a name="197474779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197474779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197474779">(May 13 2020 at 20:40)</a>:</h4>
<p>AH, found it!! There are symlinks inside the nix-packages with rust-src which rust-analyzer does not resolve!</p>



<a name="197475021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197475021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197475021">(May 13 2020 at 20:42)</a>:</h4>
<p>Is it expected that rust-analyzer would resolve symlinks?</p>



<a name="197476722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197476722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197476722">(May 13 2020 at 20:58)</a>:</h4>
<p>rls seems to FWIW</p>



<a name="197479686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197479686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197479686">(May 13 2020 at 21:23)</a>:</h4>
<p>yeah, we currently ignore symlink</p>



<a name="197510197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20in%20nix/near/197510197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Albert Cervin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20in.20nix.html#197510197">(May 14 2020 at 06:30)</a>:</h4>
<p>I have a working workaround now! Thanks for all the help!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>